
# ======================================================================
# Project:    Closed borders, closed minds? COVID-related border closures,
#             EU support and hostility towards immigrants
#
# Script:     Appendix Figure A1 and A2
#
# Authors:    Lisa Herbig (l.j.herbig@uva.nl)
#             Asli Unan (a.unan@uva.nl)
#
# Date:       2025-03-24
# ======================================================================

# Description:
# This script generates Appendix Figure A1 and Figure A2, presenting the attention to border closures based on google trends data and German newspaper headlines

# ----------------------------------------------------------------------
# Load libraries
# ----------------------------------------------------------------------
library(readr)
library(tidyverse)

#Appendix Figure A.1
german_raw <- read_csv("~/Dropbox/COVIDEU/WP 1 Borders & Mobility/german_newspapers.csv")
german <- german_raw[,-1]


ggplot(data = german,
       mapping = aes(x = date,
                     y = attention,
                     color = newspaper)) +
  geom_line() +
  labs(color = 'Newspaper',
       y = 'Attention',
       x = 'Date') +
  theme_bw()


#Appendix Figure A.2
google_raw <- read.csv("~/Dropbox/COVIDEU/WP 1 Borders & Mobility/multiTimeline-2.csv",
                   header = FALSE,
                   sep = ",")
google <- google_raw[-c(1,2),] %>%
  rename(week = V1,
         attention = V2) %>%
  mutate(week = as.Date(week,
                        format = "%Y-%m-%d"),
         attention = as.numeric(attention))

ggplot(data = google,
       mapping = aes(x = week,
                     y = attention))+
  geom_line(color = "blue") +
  labs(x = 'Date',
       y = 'Search index') +
  theme_bw()


